using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class Ch_chartPageMap : EntityTypeConfiguration<Ch_chartPage>
    {
        public Ch_chartPageMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            // Table & Column Mappings
            this.ToTable("Ch_chartPage");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.ChartID).HasColumnName("ChartID");
            this.Property(t => t.SectionID).HasColumnName("SectionID");
            this.Property(t => t.Image).HasColumnName("Image");
            this.Property(t => t.Note).HasColumnName("Note");
            this.Property(t => t.LastUpdateUser).HasColumnName("LastUpdateUser");
            this.Property(t => t.LastUpdateDate).HasColumnName("LastUpdateDate");

            // Relationships
            this.HasOptional(t => t.CH_chart)
                .WithMany(t => t.Ch_chartPage)
                .HasForeignKey(d => d.ChartID);
            this.HasOptional(t => t.frm_section2)
                .WithMany(t => t.Ch_chartPage)
                .HasForeignKey(d => d.SectionID);

        }
    }
}
